#pragma once
#include "Character.h"
#include "Ladder.h"
#include "Platform.h"
#include "Enemy.h"
#include "MeleeEnemy.h"
#include "RangeEnemy.h"
#include "AnimalEnemy.h"
#include "PickUp.h"

#include "ProtectQuest.h"
#include "HuntQuest.h"
#include "CollectQuest.h"

#include "Inventory.h"
#include "Achievement.h"

#include "Particle.h"

#include <vector>

#define MINSIZE 80
#define MAXSIZE 680

#define MAXENEMY 15

/**
	* Abstract class for level
	*
	* Storage for items needed at all levels.
	* Creation of platform and ladder for all levels.
	* Virtual function for Initialize of level, render of level and update of level
*/
class Level{
public:
	enum QUESTTYPE { PROTECT, HUNT, COLLECT };
private:
	BaseQuest *newQuest;

	int enemyID, numOfEnemy, numOfSpawner;
	
	bool spawnMob;

	MessageBoard *msgBoard;

	CCountdownTimer spawnTimer;
public:
	Character *player;

	freetype::font_data our_font,
						char_font;

	float FrameTime;

	vector<Platform *> FloorList;
	vector<Platform *> SpawnerList;
	vector<Platform *> SpecialSpawnerList;
	vector<Ladder *> LadderList;
	vector<Enemy *> EnemyList;
	vector<PickUp *> PickUpList;

	bool init, win;

	int QuestType;

	Level(void);
	~Level(void);

	/**
		* Function that creates ladder to add into the list of objects
		*
		* @param Position of ladder
		* @param The number of steps for the ladder
	*/
	void CreateLadder(Vector3D position, int height, Ladder::LADDERTYPE type);
	
	/**
		* Function that creates platforms to add into the list of objects
		*
		* @param Position of platform
		* @param Number of platform
	*/
	void CreatePlatform(Vector3D position, int width, int height, Platform::PATHTYPE type, float r, float g, float b);

	/**
		* Function that creates enemy to add into the list of objects
		*
		* @param Position of enemy
	*/
	void CreateEnemy( Vector3D position , Vector3D oOff);

	/**
		* Function that creates pickup to add into the list of objects
		*
		* @param Position of pickup
		* @param Type of item
	*/
	void CreatePickUp( Vector3D position, Item::no itemNumber );

	BaseQuest::QUESTSTATUS GetQuestStatus(void);

	/**
		* Function to initialize the level
		*
		* Initialize all gameobject here
		* @param Pass in a player that is created outside of the level. Reduce need to create a player each level
	*/
	virtual void InitLevel(Character *player, QUESTTYPE questType, int difficulty);

	/**
		* Function to render the entire level
	*/
	virtual void RenderLevel(void);

	/**
		* Function to update level
		*
		* @param Pass in elapsed time for frame independent movement
	*/
	virtual bool UpdateLevel(float elapsed);
};